using System;
using System.Threading.Tasks;
using Terra.Core.Common.ApiResponse;
using Terra.Core.Common.Models.Pagination;
using Terra.Service.Common.Base;
using Terra.Service.Logging.DTOs;

namespace Terra.Service.Logging.Interfaces;

/// <summary>
/// 登录日志服务接口
/// </summary>
public interface ILoginLogService : IAppService
{
    /// <summary>
    /// 记录登录日志
    /// </summary>
    /// <param name="request">创建请求</param>
    /// <returns>日志ID</returns>
    Task<ApiResponse<Guid>> LogAsync(CreateLoginLogRequest request);

    /// <summary>
    /// 分页查询登录日志
    /// </summary>
    /// <param name="request">查询参数</param>
    /// <returns>分页结果</returns>
    Task<ApiResponse<PagedList<LoginLogDto>>> GetPagedListAsync(LoginLogPagedRequest request);

    /// <summary>
    /// 清理指定时间之前的日志
    /// </summary>
    /// <param name="beforeTime">清理该时间之前的日志</param>
    /// <returns>清理的记录数</returns>
    Task<ApiResponse<int>> CleanAsync(DateTime beforeTime);
}